package com.fanxj.service.impl;

import com.fanxj.domain.*;
import com.fanxj.mapper.UserMapper;
import com.fanxj.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;
@Service("UserService")
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;

    @Override
    public List<User> findAll() {
        return userMapper.findAll();
    }

    @Override
    public User findByUser(User user) {
        return userMapper.findByUser(user);
    }

    @Override
    public String saveUser(User user) {
        //判断数据库中是否已经注册过
        User userExist=userMapper.findByUser(user);
        if(userExist!=null){
            return "exist";
        }
        userMapper.saveUser(user);
        return "success";
    }

    @Override
    public List<DecadeType> findDecadeType() {
        return  userMapper.findDecadeType();
    }

    @Override
    public List<GroupType> findGroupType() {
        return  userMapper.findGroupType();
    }

    @Override
    public List<LocalType> findLocalType() {
        return  userMapper.findLocalType();
    }

    @Override
    public DecadeType findDecadeTypeByCode(String decadeTypeCode){
        return  userMapper.findDecadeTypeByCode(decadeTypeCode);
    }

    @Override
    public GroupType findGroupTypeByCode(String groupTypeCode) {
        return userMapper.findGroupTypeByCode(groupTypeCode);
    }

    @Override
    public LocalType findLocalTypeByCode(String localTypeCode) {
        return userMapper.findLocalTypeByCode(localTypeCode);
    }

    @Override
    public List<Relic> findRelic(Params params) {
        return userMapper.findRelic(params);
    }

    @Override
    public void collectionRelic(CollectionRelic crelic) {
        userMapper.collectionRelic(crelic);
    }
    @Override
    public CollectionRelic IsExitcollectionRelic(CollectionRelic crelic) {
       return userMapper.IsExitcollectionRelic(crelic);
    }

    @Override
    public List<Relic> searchCollection(User user) {
        return userMapper.searchCollection(user);
    }

    @Override
    public void deleteCollection(DeleteCollection delCollection) {
        userMapper.deleteCollection(delCollection);
    }

    @Override
    public   List<Relic>  SearchCollectionRelic(SearchPersonRelics searchPerson) {
        return  userMapper.SearchCollectionRelic(searchPerson);
    }

    @Override
    public List<Relic> Search(String searchValue) {
        return userMapper.Search(searchValue);
    }

    @Override
    public DecadeType findDecadeTypeByLabel(String decadeTypeLabel) {
        return userMapper.findDecadeTypeByLabel(decadeTypeLabel);
    }

    @Override
    public GroupType findGroupTypeByLabel(String groupTypeLabel) {
        return userMapper.findGroupTypeByLabel(groupTypeLabel);
    }

    @Override
    public LocalType findLocalTypeByLabel(String localTypeLabel) {
        return userMapper.findLocalTypeByLabel(localTypeLabel);
    }

    @Override
    public List<Relic> Recommend(Params params) {
        return userMapper.Recommend(params);
    }

    @Override
    public void uploadHeadImage(Params params) {
        userMapper.uploadHeadImage(params);
    }

    @Override
    public void updatePassword(Params params) {
        userMapper.updatePassword(params);
    }

}
